Filter two diferent modules

Hello.

Its me again. I have write a simple dxl. He was supposed to be capable of when run in the current module apply a filter, then based on this filter, open another module and apply another filter, then print the info of both modules...

The is I wanted it to export the information from both modules to a same Excel doc. I dont even know if it is possible.

Anyway can somebody help me see here it was wrong.

Thanks. =)

 

Module mA = current

Object oA
Skip skpA = createString()
filtering off
 
Filter Saftey = (attribute "my attr" != "")
set(mA, Saftey)
 
filtering on
refresh current
 
for oA in mA do{
put(skpA, identifier(oA), oA) {
Module mB = edit("the other module path", false)
load(mB, view("the desired view"))
Object oB
 
filtering off
 
for oB in mB do {
    Filter TT = (find(skpA, (oB."Requirement tag" "")))
    set(mB, TT)
 }
filtering on
print oB."Object Text" "\n\n"
print oA."Object Text" "\n\n"
    }
}

 


braolive - Tue Jul 02 07:53:11 EDT 2013

Re: Filter two diferent modules
llandale - Tue Jul 02 13:41:29 EDT 2013

Open module mB only once.  Open it "read".  Since you figure to load a view it must be visible (unless you cleverly search forum for loading views in invisible modules).

  • Move the following line above your "for oA in mA do" loop.
  • Module mB = read("The other module path", true, true)  // true=visible; true=load Standard View

Be sure to assign the current module before your "filtering" command:

  • current = mB
  • filtering off

[1] Filtering.   If I read this correclty, you want to display those oB objects that contain  "Requirement Tag" of any displayed oA Identifier.  That is unsuitable for using a "Filter" variable, as you would need to define a huge number of such filters and "OR" them together.  Would look like:

  • (contains "AMod_123", "Requirement tag") or (contains "AMod_125", "Requirement tag") or ...

Instead you can do a manual filter:

  • current = mB
  • filtering off
  • for oB in entire mB do
  • {  reject(oB)
  •    if (isDeleted(oB))   continue
  •    ReqTag = oB."Requirement tag"
  •    if (find(skpA, ReqTag)) then accept(oB)
  • }
  • filtering on

Understand that an "accept/reject" manual filter is not a "Filter" and will not save in a view.

[2] Export.  If I infer correctly, you really do not care about "filtering", but rather you want to print each A object side-by-side with it's corresponding B object.  If so, you don't care about any filter for mB.

  • for oB in entire mB do
  • {  if (isDeleted(oB))                           then continue
  •     if (oB is otherwise disqualified) then continue
  •    ReqTag = oB."Requirement tag"
  •    if (find(skpA, ReqTag, oA)) then <<<Export oA side-by-side with oB>>>
  • }

Overall then, it seems to me this structure will work:

  • open mA, load my clever Saftey filter
  • store all oA objects
    • for oA in mA do{
    •    put(skpA, identifier(oA), oA)
    • }
  • open mB
  • Do match-up and Export code on mB as above
  • delete skpA
  • close(mB)

-Louie